﻿using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using lan_file_transfer;
using lan_file_transfer.Roads.tcp;

namespace Test
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        I_Truck truck;

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
        }

        private void Truck_LOG_EVENT(string obj)
        {
            blk.Dispatcher.Invoke(() => {
                blk.Text += obj + Environment.NewLine;
            });
        }

        private void bt_Click(object sender, RoutedEventArgs e)
        {
            truck = new TcpRoads("192.168.188.144", 10086, true);
            truck.LOG_EVENT += Truck_LOG_EVENT;
        }
        private void bt_2_Click(object sender, RoutedEventArgs e)
        {
            truck = new TcpRoads("192.168.188.144", 10086,false);
            truck.LOG_EVENT += Truck_LOG_EVENT;
            //truck.connect(2);
        }

        private void bt_3_Click(object sender, RoutedEventArgs e)
        {
            truck.connect(2);
        }
    }
}